package online.szlib.com.core.services;

import java.util.List;

import online.szlib.com.core.domain.Config;
import online.szlib.com.core.repositories.ConfigRepository;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("configService")
public class ConfigServiceImpl implements ConfigService {

	@Autowired
	private ConfigRepository configRepository;
	
	public List<Config> listConfigs(){
		return configRepository.findAll();
	}
	
	public Config getConfig(Long configId){
		return configRepository.findOne(configId);
	}
	
	public Long create(Config config){
		configRepository.save(config);
		return config.getConfigId();
	}
	
	public void update(Config config){
		configRepository.saveAndFlush(config);
	}
	
	public void deleteById(Long id) {
		configRepository.delete(id);
	}
	
	
}
